//
//  GameWeb.swift
//  LeGou
//
//  Created by lxm on 2022/8/24.
//

import UIKit
import WebKit

class GameWeb: ZMViewController, WKNavigationDelegate, UIScrollViewDelegate {
    //MARK: --------------------属性--------------------
    var url = ""
    //MARK: --------------------UI控件--------------------
    let web = WKWebView()
    //MARK: --------------------生命周期--------------------
    override func viewDidLoad() {
        super.viewDidLoad()
        setUI()
        addConstraints()
        bindAction()
    }
    //MARK: --------------------UI--------------------
    func setUI() {
        title = ""
        view.addSubview(web)
        web.load(URLRequest.init(url: URL.init(string: url)!))
        web.navigationDelegate = self

    }
    
    func addConstraints() {
        web.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
    }
    
    //MARK: --------------------methods--------------------
    func bindAction() {
        
    }

    //MARK: --------------------delegate--------------------
    // 页面加载完成之后调用
    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!){
        /// 获取网页title
        if webView.title != "" {
            self.title = webView.title
        }
    }
}
